class AddPositionForPhotos < ActiveRecord::Migration
  def self.up
    add_column :photos, :position, :integer
    
    PhotoSet.find(:all).each do |photo_set|
      photo_set.photos.each_with_index do |photo, i|
        photo.position = i
        photo.save
      end
    end
  end

  def self.down
    remove_column :photos, :position
  end
end
